#!/bin/bash

workingdir=`pwd`
scriptdir=$(readlink -f $0)
scriptdir=$(dirname $scriptdir)
mytree=$(dirname $scriptdir)

export GOBIN="${mytree}/bin"

if [ ! -f "${mytree}/bin/golangci-lint.exe" ] ; then
    echo "install golangci-lint.exe"
    bash "${mytree}/cmd/install.sh" -b "${mytree}/bin" -d latest
fi

if [ ! -f "${mytree}/bin/go-bindata.exe" ] ; then 
    echo "install go-bindata.exe"
    go get -u github.com/go-bindata/bindata/...;
    go mod tidy
fi

echo "create bindata on debug mode"
$"${mytree}/bin/go-bindata.exe" -debug -pkg=gen -o ./gen/bindata.go "./asset/..."
